<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=0, minimum-scale=1.0, maximum-scale=1.0" />
<link rel="stylesheet" type="text/css" href="__PUBLIC__/wx/shop/style/style.css">
<script type="text/ecmascript" src="__PUBLIC__/wx/shop/js/jquery-1.8.1.js"></script>
<script type="text/javascript" src="__PUBLIC__/wx/js/alert.js"></script>
<script type="text/ecmascript" src="__PUBLIC__/wx/shop/js/pay.js"></script>
<title>付款详情</title>
<script>
$(function(){
   $(".div2 ul").click(function(){
	   $(".lv_img").hide();
   });
});
</script>
</head>

<body>
<div class="box">
<!-- <div class="top">
    <a href="javascript:;" onclick="javascript:history.back(-1);"><p class="dayu"><img src="__PUBLIC__/shop/image/1.jpg"></p></a>
    <p class="biaoti"><span class="span2">付款详情</span></p>
</div> --><!--top-->
<form  method="post" id="recharge" action="">
<div class="clear"></div>
    <div class="pay">
        <div class="div1">
        <span class="span1">需付款</span><span class="span2" ><span id="sumoney"><{$money}></span>元</span>
        </div><!--div1-->
        <div class="clear"></div>
        <div class="div2">
            <div class="fu1" id="alipay">
            <div class="left" ><img src="__PUBLIC__/wx/shop/image/37.jpg">支付宝支付</div>
            <div class="right">
                <img src="__PUBLIC__/wx/shop/image/check_four12.png" style="display:none;" class="img1" id="alipay1">
                <img src="__PUBLIC__/wx/shop/image/check_four1.png" class="img2" id="alipay2">
            </div><!--right-->
            </div><!--fu1-->
            <input type="hidden" value="zfb" class="value" />
            <div class="clear"></div>

            <div class="fu1" id="wxpay">
            <div class="left" ><img src="__PUBLIC__/wx/shop/image/38.jpg">微信支付</div>
            <div class="right">
              <img src="__PUBLIC__/wx/shop/image/check_four12.png" class="img1" id="wxpay1">
              <img src="__PUBLIC__/wx/shop/image/check_four1.png" style="display:none;" class="img2" id="wxpay2">
            </div><!--right-->
            </div><!--fu1-->

            <div class="fu1" id="yunpay">
                <div class="left" ><img src="__PUBLIC__/shop/image/65.png">云惠宝支付</div>
                <div class="right">
                    <img src="__PUBLIC__/shop/image/check_four12.png" class="img1" id="yunpay1">
                    <img src="__PUBLIC__/shop/image/check_four1.png" style="display:none;" class="img2" id="yunpay2">
                </div>
            </div>
            <script>
            $(function(){
                $("#alipay").click(function(){
                    $('#alipay1').hide();
                    $('#alipay2').show();
                    $('#wxpay1').show();
                    $('#wxpay2').hide();
                    $('#yunpay1').show();
                    $('#yunpay2').hide();
                    $('.value').attr('value','zfb');
                    //程序可以在这里用jquery在隐藏域里追加支付标识，用来区别支付方式
                });
                $("#wxpay").click(function(){
                    $('#alipay1').show();
                    $('#alipay2').hide();
                    $('#wxpay1').hide();
                    $('#wxpay2').show();
                    $('#yunpay1').show();
                    $('#yunpay2').hide();
                    $('.value').attr('value','wxpay');
                });
                $("#yunpay").click(function(){
                    $('#alipay1').show();
                    $('#alipay2').hide();
                    $('#wxpay1').show();
                    $('#wxpay2').hide();
                    $('#yunpay1').hide();
                    $('#yunpay2').show();
                    $('.value').attr('value','yunpay');
                });
            });
            </script>
        </div><!--div2-->
        <div class="clear"></div>
        <div>
        <div class="div4">
            <input type="hidden" name="theme_id" value="<{$theme_id}>">
            <a href="javascript:void(0)" class="submit">确认支付</a>
          <!-- <input type="submit" value="确认支付" onClick="radios()"/> -->
        </div><!--div4-->
    </div><!--pay-->
    </div>
</form>
</div><!--box-->
<script type="text/javascript">
    var theme_id = $("input[name=theme_id]").val();
    var money = $("#sumoney").html();
    $('.submit').click(function(){
        var payment = $(".value").val();
        $.ajax({
          url: '__APP__/Home/ThemePay/is_user_buy_theme',
          type: 'post',
          data: {theme_id:theme_id,money:money},
          success:function(data) {
              if (data == 1) {
                  if(money!==''&& money>0){
                      if (payment === 'wxpay') {
                          window.Yunoso.WXChat(money+'',theme_id);
                      } else if (payment === 'zfb'){
                          window.location.href='/index.php/Home/ThemePay/post_app_pay?money='+money+'&theme_id='+theme_id;
                      } else {
                          window.Yunoso.showPswDialog();
                      }
                  }
              } else {
                  alert(data);
              }
          },
          error:function() {
              alert('服务器繁忙，请稍后再试！');
          }
      });
    });

  /**
   * android端云惠宝支付JS接口
   * @param passwd string 密码
   */
  function yunpay(passwd){
      $.ajax({
          url:'/index.php/Home/ThemePay/post_yunpay',
          type:'post',
          data:{
              password:passwd,
              money:money,
              theme_id:theme_id
          },
          success:function(data){
            if (data == 1) {
                alert('支付成功');
            } else {
                alert(data);
            }
          },
          error:function(){
              alert("服务器繁忙,请稍后再试!");
          }
      });
  }
</script>
</body>

</html>
